package com.adopapa.wechatapi;

import java.io.File;

import com.adopapa.wechatapi.application.service.WeChatApi;
import com.adopapa.wechatapi.application.service.WeChatService;
import com.adopapa.wechatapi.domain.common.ResultMessage;
import com.adopapa.wechatapi.domain.media.UploadMediaResult;
import com.adopapa.wechatapi.domain.media.UploadMediaResult.MediaType;
import com.adopapa.wechatapi.domain.message.Image;
import com.adopapa.wechatapi.domain.message.ResponseMessage;
import com.adopapa.wechatapi.domain.message.customer.CustomerServiceMessage;
import com.adopapa.wechatapi.domain.token.AccessToken;

public class PictureMessage {
	
	public static void main(String[] args) throws Exception {
		
//		String appId = "wxb30952334a28c368";
//		String appSecret= "82a3a93271b370638de9e3c3b267da27";
//		
//		AccessToken accessToken = WeChatApi.getAccessToken(appId, appSecret);
//		System.out.println(accessToken);
		
		String token = "uTitNO2MVPE31cSulSOd_Q9eLsfu04ccJT6J7VZeQlxASqJ2wmfY2uLOSrycowt-4VHfz9RGZ8vNeDjh8B2EUcKmb_jX2VWXuHocyqH8D62G6swSFmBCya76Oj8_c1V5XJAgAAAEQH";
		
		
//		File file = new File("/home/adopapa/桌面/customer_service.jpg");
		WeChatService weChatService = new WeChatService();
//		UploadMediaResult uploadMedia = weChatService.uploadMedia(token, file, MediaType.image);
//		
//		System.out.println(uploadMedia);
		
		
		Image image = new Image();
//		image.setMediaId(uploadMedia.getMediaId());
		image.setMediaId("l3sO4KLOh4HlnLWOW7b8W1wJG-lVdVMHGqV1mH9CfMz-1732KxnL_9RawGPEw4Om");
		CustomerServiceMessage customerServiceMessage = new CustomerServiceMessage();
		customerServiceMessage.setImage(image);
		customerServiceMessage.setMsgType(ResponseMessage.MessageType.image.name());
		customerServiceMessage.setToUser("okkwgt3rADJlkQnV4UGsrf4zGFno");
		
		
		
		
		
		ResultMessage resultMessage = weChatService.sendCustomerServiceMessage(customerServiceMessage, token);
		System.out.println(resultMessage);
		
	
		
		
		
	}

}
